package cn.lili.controller.order;


import cn.lili.common.aop.annotation.PreventDuplicateSubmissions;
import cn.lili.common.vo.PageVO;
import cn.lili.common.vo.ResultMessage;
import cn.lili.modules.order.order.entity.dos.RankingScoreDetails;
import cn.lili.modules.order.order.entity.dto.RankingAwardDetailsDTO;
import cn.lili.modules.order.order.entity.dto.RankingScoreDetailsDTO;
import cn.lili.modules.order.order.entity.vo.RankingScoreDetailsVO;
import cn.lili.modules.order.order.service.IRankingAwardDetailsService;
import cn.lili.modules.order.order.service.IRankingScoreDetailsService;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 积分记录表 前端控制器
 * </p>
 *
 * @author zhushiqing
 * @since 2023-12-21
 */
@AllArgsConstructor
@RestController
@RequestMapping("/order/rankingScoreDetails")
public class RankingScoreDetailsController {

    private IRankingScoreDetailsService rankingScoreDetailsService;
    private IRankingAwardDetailsService  rankingAwardDetailsService;
    /**
     * 某一个店主 ==> 积分变动记录
     *
     * @return 某个店主的积分变动记录
     */
    @GetMapping("/page")
    public ResultMessage<Object> scorePage(RankingScoreDetails scoreDetails, PageVO pageVO) {
        return rankingScoreDetailsService.scorePage(scoreDetails, pageVO);
    }

    @GetMapping("/getRankingScoreDetail")
    @ApiOperation("根据活动id获取积分排名列表")
    public ResultMessage<Page<RankingScoreDetailsVO>> getRankingScoreDetail(@Validated RankingScoreDetailsDTO dto){
        return rankingScoreDetailsService.getRankingScoreDetail(dto);
    }

    @GetMapping("/getRankingScoreDetailByUserId")
    @ApiOperation("根据用户id获取积分明细商品列表 总积分详情-->商品明细列表")
    public ResultMessage<Page<RankingScoreDetails>> getRankingScoreDetailByUserId(@Validated RankingScoreDetailsDTO dto) {
        return rankingScoreDetailsService.getRankingScoreDetailByUserId(dto);
    }

    @GetMapping("/getRankingAwardLogisticsById")
    @ApiOperation("根据用户id获取活动排名奖品-物流记录")
    public ResultMessage<Object> getRankingAwardLogisticsById(@RequestParam(value = "rankingAwardDetailsId",required = true) String rankingAwardDetailsId, @RequestParam(value = "queryFrom", required = true) Integer queryFrom) {
        return rankingAwardDetailsService.getRankingAwardLogisticsById(rankingAwardDetailsId, queryFrom);
    }
    @PostMapping("/addRankingAwardExpressInfo")
    @ApiOperation("给排名奖品明细添加运单号")
    @PreventDuplicateSubmissions
    public ResultMessage<Object> addRankingAwardExpressInfo(@RequestBody @Validated RankingAwardDetailsDTO dto) {
        return rankingAwardDetailsService.addRankingAwardExpressInfo(dto);
    }

    @ApiOperation("店家列表-->总佣金 详情-->列表")
    @GetMapping("/getDistributeionSubCommissDetails")
    public ResultMessage<Page<RankingScoreDetails>> getDistributeionSubCommissDetails(RankingScoreDetailsDTO dto){
        return rankingScoreDetailsService.getDistributeionSubCommissDetails(dto);
    }


}
